# set -x

# --page_start 0 --page_limit 1
while echo $1 | grep -q ^--; do
    # Evaluating a user entered string!
    # Red flags!!!  Don't do this
    eval $( echo $1 | sed 's/^--//' )=$2
    shift
    shift
done

url="https://movie.douban.com/j/search_subjects?type=movie&tag=%E8%B1%86%E7%93%A3%E9%AB%98%E5%88%86&sort=recommend&watched=on&page_limit=${page_limit}&page_start=${page_start}"

curl --silent --cookie 'bid=yQwoxzg1NC8; douban-fav-remind=1; ap_v=0,6.0; __gads=ID=82a0fa639e023939:T=1589246003:S=ALNI_MYwDGGj8Pd4rF3bEm6PQfqQWpVCug' \
     $url \
     2>&1 > films.json

cat films.json
